package com.learn.im.domain;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "chat")
public class Chat implements Serializable {
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 消息类型(文字、文件)
     */
    @TableField(value = "msg_type")
    private String msgType;

    /**
     * 聊天类型(普通、广播、上线通知、下线通知)
     */
    @TableField(value = "chat_type")
    private String chatType;

    /**
     * 消息内容
     */
    @TableField(value = "content")
    private String content;

    /**
     * 来自于
     */
    @TableField(value = "`from`")
    private String from;

    /**
     * 发送给
     */
    @TableField(value = "`to`")
    private String to;

    /**
     * 消息时间
     */
    @TableField(value = "`time`")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date time;

    /**
     * 消息状态(0已读、1未读)
     */
    @TableField(value = "`status`")
    private Boolean status;

    private static final long serialVersionUID = 1L;
}
